<template>
  <div>
    <div id="example" style="height: 600px"></div>
  </div>
</template>

<script setup lang="ts">
// 基本使用
import * as echarts from "echarts";
import { onMounted } from "vue";
onMounted(() => {
  // 初始化一个 echarts 实例
  const chart = echarts.init(document.getElementById("example")!);
  // 画图配置对象
  var option = {
    title: {
      text: "ECharts \n 入门示例",
      subtext: "副标题",
      textStyle: {
        color: "yellowgreen",
        fontSize: 30,
      },
    },
    tooltip: {},
    legend: {
      data: ["销量", "销售额"],
    },
    xAxis: {
      data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
    },
    yAxis: {},
    series: [
      {
        name: "销量",
        type: "bar",
        data: [5, 20, 36, 10, 10, 20],
      },
      {
        name: "销售额",
        type: "pie",
        data: [55, 20, 76, 10, 30, 20],
        radius: [100, 400],
      },
    ],
  };
  // 通过setOption方法告诉实例对象要如何画
  chart.setOption(option);
});
</script>

<style scoped></style>
